From: Martin Stjernholm Date: Tue, 20 Aug 2002 21:58:51 +0000 (+0000) Subject: (c-forward-syntactic-ws): Fixed a bug that could cause an infinite X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~31071 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=70b9029a0fd56422fafe68c1bdb94d73405cafce;p=emacs.git (c-forward-syntactic-ws): Fixed a bug that could cause an infinite loop if something that looks like a macro begins in the middle of a line. (c-parse-state): Fixed a bug that could cause `c-state-cache' to contain two conses in sequence when there's an unbalanced open paren in a macro. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 3994c5cc22c..4fdfbcf9502 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -642,8 +642,9 @@ specified." (forward-char)) ;; Skip preprocessor directives. ((and (looking-at "#[ \t]*[a-zA-Z0-9!]") - (progn (skip-chars-backward " \t") - (bolp))) + (save-excursion + (skip-chars-backward " \t") + (bolp))) (end-of-line) (while (and (<= (point) lim) (eq (char-before) ?\\) @@ -1245,6 +1246,11 @@ you need both the type of a literal and its limits." (setq c-state-cache (cdr c-state-cache))) (setq pairs (car pairs)) (setcar pairs (1- (car pairs))) + (when (consp (car-safe c-state-cache)) + ;; There could already be a cons first in `c-state-cache' + ;; if we've jumped over an unbalanced open paren in a + ;; macro below. + (setq c-state-cache (cdr c-state-cache))) (setq c-state-cache (cons pairs c-state-cache))) (if last-pos ;; Prepare to loop, but record the open paren only if it's